centos7.9服务器网卡聚合

您所在的位置:网站首页 centos7 网卡bond centos7.9服务器网卡聚合

centos7.9服务器网卡聚合

2024-07-11 00:08| 来源: 网络整理| 查看: 265

Linux网卡链路聚合

一、Linux配置,centos7.9首先启动bonding模块:modprobe bonding;查看bonding模块状态命令:cat /proc/net/bonding/bond0

1、在Linux系统上,可以使用bonding模块来实现网口聚合。以下是一个简单的示例配置文件/etc/sysconfig/network-scripts/ifcfg-bond0,假设我们创建了一个名为bond0的聚合组:

[root@localhost network-scripts]# cat ifcfg-bond0

TYPE=Bond

NAME=bond0

DEVICE=bond0    //没有这个名称定义会出现网卡重启失败BONDING_MASTER=yes

BOOTPROTO=none

ONBOOT=yes

IPADDR=192.168.132.233

NETMASK=255.255.255.0

GATEWAY=192.168.132.1

BONDING_OPTS="mode=4 miimon=100"

然后,对应的两个物理网口的配置文件/etc/sysconfig/network-scripts/ifcfg-eth0和/etc/sysconfig/network-scripts/ifcfg-eth1如下:

[root@localhost network-scripts]# cat ifcfg-enp2s0

DEVICE=enp2s0

ONBOOT=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

USERCTL=no

[root@localhost network-scripts]# cat ifcfg-enp3s0

DEVICE=enp3s0

ONBOOT=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

USERCTL=no

在这个示例中,我们创建了一个名为bond0的聚合组,并将eth0和eth1作为从属网口。BONDING_OPTS中的mode=4表示使用802.3ad模式(即LACP),miimon=100表示每100毫秒检测链路状态。

重启网卡

交换机配置(以H3C交换机为例) 创建一个聚合组Trk1,并指定聚合组的工作模式为LACP:

interface Bridge-Aggregation 1

description Link Aggregation Group

link-aggregation mode dynamic  //指定了聚合使用了LACP模式

接下来,将端口1和端口2加入到聚合组Trk1中:

interface GigabitEthernet 1/0/1

port link-aggregation group 1 

interface GigabitEthernet 1/0/2

port link-aggregation group 1

配置模式

interface Bridge-Aggregation 1

port link-type access

port access vlan XXX

思科交换机配置

interface Port-channel1

 description server bond

 switchport access vlan 132

 switchport mode access

interface GigabitEthernet1/0/11

 switchport access vlan 132

 switchport mode access

 channel-group 1 mode active

interface GigabitEthernet1/0/12

 switchport access vlan 132

 switchport mode access

 channel-group 1 mode active



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3